<template>
  <div>
    <a-table bordered :columns="columns" :rowKey="record => record.id"
      :data-source="dataSource" :pagination="pagination"
      :scroll="{ x: true }" @change="handleTableChange" :loading="loading">
    </a-table>
    <div class="footer">
      <a-button type="primary" @click="this.$emit('close')">返回</a-button>
    </div>
  </div>
</template>
<script>
import { listMixin } from "../../micromall/util/listMixin";
import add from './form.vue'
import { postAction } from '@/api/manage'
const columns = [
  {
    title: '时间',
    width: 200,
    dataIndex: 'createTime'
  },
  {
    title: '修改人',
    width: 200,
    dataIndex: 'operatorName'
  },
  {
    title: '修改内容',

    dataIndex: 'operateDesc'
  },
  {
    title: '修改结果',
    width: 200,
    dataIndex: 'operateResult'
  }
]

export default {
  mixins: [listMixin],
  props:{
    taskId: {
      type:[String,Number],
      default: ''
    }
  },
  data() {
    return {

      url: {
        list: '/jic-backend-pos/pos/voucherTask/log'
      },
      columns,
      loading: false,
    }
  },
  components: {
    add
  },
  methods: {
    loadData(arg) {
      if (!this.url.list) {
        this.$message.error('请设置url.list属性!')
        return
      }
      //加载数据 若传入参数1则加载第一页的内容
      if (arg === 1) {
        this.pagination.current = 1
      }
      var params = this.getQueryParams() //查询条件
      const taskId = this.$props.taskId
      postAction(`${this.url.list}?taskId=${taskId}`, params).then(res => {
        if (res.code == 200) {
          //update-end---author:wsp    Date:20210826
          this.dataSource = res.data.records || res.data
          if (res.data.total) {
            this.pagination.total = res.data.total
          } else {
            this.pagination.total = 0
          }
        } else {
          this.$message.warning(res.msg)
        }
        this.loading = false
      }).catch(() => {
        this.loading = false
      })
    },
  }
}
</script>
<style scoped>
.goods-img {
  width: 50px;
  height: 50px;
}

.goods-img:not(:last-child) {
  margin-right: 10px;
}
.footer{
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
}
</style>
